#include<graphics.h>
#include<iostream>
#include<fstream> 
#define H 511
#define W 1023
int main(){
	initgraph(W,H);
	setbkcolor(EGERGB(0xFF,0xFF,0xFF));
	int i=0,x,y,r,g,b;
	while(1){
		std::ifstream is("painted.txt",std::ios::in);
		while(is>>x>>y>>r>>g>>b){
			if(x<=0||x>=W||y<=0||y>=H)
				continue;
			if(std::max(r,std::max(g,b))>256)
				continue;
			setcolor(EGERGB(r,g,b)); 
			putpixel(x,y,EGERGB(r,g,b));
		}
		is.close();
		getch();
		cleardevice();
	}
	return 0;
}
